package com.springcloud.consumeruser;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.client.loadbalancer.LoadBalanced;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;

/**
 * 功能描述: <br>
 * 〈服务消费者〉
 *
 *
 * @since: 1.0.0
 * @Author:Lcs
 * @Date: 2018/10/9 17:14
 */

@EnableDiscoveryClient//开启发现服务功能，可以从注册中心获取到其它服务并且来调用
@SpringBootApplication
public class ConsumerUserApplication {

    public static void main(String[] args) {
        SpringApplication.run(ConsumerUserApplication.class, args);
    }

    //如何调用，需要结合RestTemplate，它是用来发送http请求
    @LoadBalanced//发送http请求时开启负载均衡机制
    @Bean//放到容器中
    public RestTemplate restTemplate(){
        return new RestTemplate();
    }
}
